
package pri.syl.xiaowu.websocket.netty.server.thread;


import  pri.syl.xiaowu.websocket.core.template.WebsocketChannelTemplate;
import  pri.syl.xiaowu.websocket.core.template.WebsocketRouteTemplate;
import lombok.Getter;
import lombok.Setter;

/**
 * @Author YunLong
 * @Date 2021/7/18 19:29
 * @Description 超时线程
 **/
@Getter
@Setter
public abstract class AbstractWebsocketServerTimeoutThread implements Runnable {
    private WebsocketRouteTemplate websocketRouteTemplate;
    private WebsocketChannelTemplate websocketChannelTemplate;

    public AbstractWebsocketServerTimeoutThread(WebsocketRouteTemplate websocketRouteTemplate, WebsocketChannelTemplate websocketChannelTemplate) {
        this.websocketRouteTemplate = websocketRouteTemplate;
        this.websocketChannelTemplate = websocketChannelTemplate;
    }

    /**
     * timeout
     *
     * @param websocketRouteTemplate   websocketRouteTemplate
     * @param websocketChannelTemplate websocketChannelTemplate
     */
    protected abstract void timeout(WebsocketRouteTemplate websocketRouteTemplate, WebsocketChannelTemplate websocketChannelTemplate);

    @Override
    public void run() {
        timeout(this.websocketRouteTemplate,
                this.websocketChannelTemplate);
    }
}
